<?php
class groupmodel extends CI_Model 
{
	function groupmodel()
	{
		 parent::__construct();
        
        $this->_table='groups';
	}
	
	function getListById($uid)
	{
		$this->db->select('*');
		$this->db->where('user_id', $uid);
		$this->db->order_by("title", "asc"); 
		$this->db->from($this->_table);
		$result = $this->db->get();
		return $result->result();
	}
	
	function getListByIds($ids)
	{
		$this->db->select('* ');
		$this->db->where_in('id', $ids);
		$this->db->order_by("name", "asc"); 
		$this->db->from($this->_table);
		$result = $this->db->get();
		return $result->result();
	}
	function insert($data) 
	{
			$data['created'] = date('Y-m-d H:i:s');
		 $this->db->insert($this->_table, $data);
		  return $this->db->insert_id();
	}
}